﻿namespace DesignModeConsole.行为型.解释器模式.告警规则简单;

/// <summary>
/// 告警规则解释器
/// </summary>
public class AlertRuleInterpreter1
{
    private readonly IAlertRuleExpression1 _alertRuleExpression;

    /// <summary>
    /// key1 > 100 && key2 < 1000 || key3 == 200
    /// </summary>
    /// <param name="ruleExpression"></param>
    public AlertRuleInterpreter1(string ruleExpression)
    {
        // 不包含扩展的情况处理方案
        _alertRuleExpression = new OrExpression1(ruleExpression);
    }

    public bool Interpret(Dictionary<string, long> statuDic)
    {
        return _alertRuleExpression.Interpret(statuDic);
    }
}